import Vue from 'vue'
import VueRouter from 'vue-router'
// import Home from '../views/Home.vue'
import Login from "../admin/views/Login.vue";
import Home from "../admin/views/Home.vue";

Vue.use(VueRouter)

  const routes = [
    {
      path: '/',
        name: 'AdminLogin',
        component: Login
    },
  {
    path: '/home',
    name: 'Home',
    component: Home,
    children: [
      {
        path: '/courses',
        name: 'Courses',
        component: () => import('../views/Courses.vue')
      },
      {
        path: '/course/:id',
        name: 'Course',
        component: () => import('../views/Course.vue')
      },
      {
        path: '/createCourse',
        name: 'CreateCourse',
        component: () => import('../views/EditCourse.vue')
      },
      {
        path: '/editCourse/:id',
        name: 'EditCourse',
        component: () => import('../views/EditCourse.vue')
      },
      {
        path: 'createChapter',
        name: 'CreateChapter',
        component: () => import('../views/EditChapter.vue')
      },
      {
        path: 'editChapter/:id',
        name: 'EditChapter',
        component: () => import('../views/EditChapter.vue')
      },
      {
        path: '/experiments',
        name: 'Experiments',
        component: () => import('../views/Experiments.vue')
      },
      {
        path: '/pub/images',
        name: 'PubImages',
        component: () => import('../views/PubImages.vue')
      },
      {
        path: '/my/images',
        name: 'MyImages',
        component: () => import('../views/MyImages.vue')
      },
      {
        path: '/my/instances',
        name: 'MyInstances',
        component: () => import('../views/MyInstances.vue')
      },
      {
        path: '/experiment/:id',
        name: 'Experiment',
        component: () => import('../views/Experiment.vue')
      },
      {
        path: '/edit/experiment/:id',
        name: 'EditExperiment',
        component: () => import('../views/EditExperiment.vue')
      },
      {
        path: '/edit/experiment/desc/:id',
        name: 'EditExperiment',
        component: () => import('../views/EditExperimentDesc.vue')
      },
      {
        path: '/create/experiment',
        name: 'CreateExperiment',
        component: () => import('../views/EditExperiment.vue')
      },
      {
        path: '/env/set/:experiment_id',
        name: 'ExperimentSetEnv',
        component: () => import('../views/EditEnv.vue')
      },
      {
        path: '/env/:id',
        name: 'ExperimentEnv',
        component: () => import('../views/ExperimentEnv.vue')
      },
      // {
      //   path: '/envs',
      //   name: 'ExperimentEnvs',
      //   component: () => import('../views/ExperimentEnvs.vue')
      // },
      {
        path: '/images',
        name: 'Images',
        component: () => import('../views/Images.vue')
      },
      {
        path: '/image/import',
        name: 'ImportImage',
        component: () => import('../views/ImportImage.vue')
      },
      {
        path: '/image/create1',
        name: 'ImageCreate1',
        component: () => import('../views/ImageCreate1.vue')
      },
      {
        path: '/image/create2/:ins_id/:image_id',
        name: 'ImageCreate2',
        component: () => import('../views/ImageCreate2.vue')
      },
      {
        path: '/knowledges',
        name: 'Knowledges',
        component: () => import('../views/Knowledges.vue')
      },
      {
        path: '/questions',
        name: 'Questions',
        component: () => import('../views/Questions.vue')
      },
      {
        path: '/edit/ques/:id/:question_type',
        name: 'EditQues',
        component: () => import('../views/EditQues.vue')
      },
      {
        path: '/create/ques',
        name: 'CreateQues',
        component: () => import('../views/EditQues.vue')
      },
      {
        path: '/reports',
        name: 'Reports',
        component: () => import('../views/Reports.vue')
      },
      {
        path: '/report/judge/:id',
        name: 'JudgeReport',
        component: () => import('../views/JudgeReport.vue')
      },
      {
        path: '/exams',
        name: 'Exams',
        component: () => import('../views/Exams.vue')
      },
      {
        path: '/edit/exam/:id',
        name: 'EditExam',
        component: () => import('../views/EditExam.vue')
      },
      {
        path: '/create/exam',
        name: 'CreateExam',
        component: () => import('../views/EditExam.vue')
      },
      {
        path: '/exam/:id',
        name: 'Exam',
        component: () => import('../views/Exam.vue')
      },
      {
        path: '/students',
        name: 'Students',
        component: () => import('../views/Students.vue')
      },
      {
        path: '/student/:id',
        name: 'Student',
        component: () => import('../views/Student.vue')
      },
      {
        path: '/judge/paper/:id',
        name: 'JudgePaper',
        component: () => import('../views/JudgePaper.vue')
      },
      {
        path: '/govs',
        name: 'Govs',
        component: () => import('../views/Govs.vue')
      },
      {
        path: '/pwd',
        name: 'Pwd',
        component: () => import('../views/Pwd.vue')
      }//append
  
    ]
  }
]

const VueRouterPush = VueRouter.prototype.push
VueRouter.prototype.push = function push (to) {
  return VueRouterPush.call(this, to).catch(err => err)
}

const router = new VueRouter({
  routes
})

export default router
